// function Person(name, age) {
//   this.name = name
//   this.age = age
// }

// Person.prototype.say = function () {
//   console.log(this.name)
// }

// function Student(name, age, score) {
//   Person.call(this, name, age)
//   this.score = score
// }
// Student.prototype = new Person()

class Person {
  constructor(name, age) {
    this.name = name
    this.age = age
  }
  // 直接写在类的结构体中拿到属性或方法,是添加到了原型上的
  say() {
    console.log(this.name)
  }
}

class Student extends Person {
  constructor(name, age, score) {
    super(name, age)
    this.score = score
  }
}

const p1 = new Person('zs', 19)
console.log(p1)
p1.say()

const s1 = new Student('ls', 18, 100)
console.log(s1)
s1.say()
